﻿@{
    ViewBag.Title = "Add";
    Layout = null;
}

@using Shop.Entity;
@using Shop.Help;
@model TBusiness
<link href="~/Content/admin/css/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-1.10.2.min.js"></script>
<script src="~/Content/My97DatePicker/WdatePicker.js"></script>
<div class="modal-body">
    <ol class="breadcrumb">
        <li><a href="/set/admin/center">首页></a></li>
        <li><a href="#">商户管理></a></li>
        <li class="active">商户列表</li>
    </ol>
    <input type="hidden" name="returnUrl" value="" />
    @{Html.BeginForm("add", "business", FormMethod.Post, new { @class = "form-horizontal", @id = "add" });}
    @Html.HiddenFor(c => c.Guid)
    @Html.HiddenFor(c => c.OperatorGuid)
    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">*商户名称</label>
                <div class="col-sm-3">
                    @Html.TextBoxFor(c => c.BusinessName, new { @class = "form-control input-sm", @placeholder = "", @datatype = "*1-50", @errormsg = "商户名称不能超过50个字符！", @nullmsg = "请输入商户名称！" })
                </div>
                <label class="col-sm-2 control-label">所属加盟</label>
                <div class="col-sm-3">
                    <select class="form-control input-sm">
                        <option>-请选择-</option>
                    </select>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">*法人代表</label>
                <div class="col-sm-3">
                    @Html.TextBoxFor(c => c.Contact, new { @class = "form-control input-sm", @placeholder = "", @datatype = "*1-50", @errormsg = "法人代表不能超过50个字符！", @nullmsg = "请输入法人代表！" })
                </div>
                <label class="col-sm-2 control-label">*联系方式</label>
                <div class="col-sm-3">
                    @Html.TextBoxFor(c => c.Tel, new { @class = "form-control input-sm", @placeholder = "", @datatype = "*1-20", @errormsg = "联系方式不能超过20个字符！", @nullmsg = "请输入联系方式！" })
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">*到期时间</label>
                <div class="col-sm-3">

                    @Html.TextBoxFor(c => c.DueTime, new { @class = "form-control input-sm", @placeholder = "", @datatype = "*1-20", @errormsg = "作者不能超过20个字符！", @nullmsg = "请选择到期时间!", @Value = Model.DueTime == null ? "" : Convert.ToDateTime(Model.DueTime).ToString("yyyy-MM-dd"), @onclick = "WdatePicker();" })
                </div>
                <label class="col-sm-2 control-label">*显示排序</label>
                <div class="col-sm-3">

                    @Html.TextBoxFor(c => c.Sort, new { @class = "form-control input-sm", @datatype = "n", @errormsg = "排序必须数字！", @nullmsg = "请填写排序!" })
                    <p class="text-primary">显示顺序数值越大越优先展示</p>
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">*所在地</label>
                <div class="col-sm-6">
                    @Html.GetAddress(c => c.ProvinceId, c => c.CityID, c => c.DistrictId, new { })
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">*所属行业</label>
                <div class="col-sm-3">
                    @Html.DropDownListFor(c => c.IndustryGuid, (IEnumerable<SelectListItem>)ViewData["Industry"], new { @class = "form-control input-sm", @datatype = "*1-100", @errormsg = "请选择所属行业！", @nullmsg = "请选择所属行业！" })
                </div>
            </div>
        </div>
    </div>


    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">*详细地址</label>
                <div class="col-sm-8">
                    @Html.TextBoxFor(c => c.Address, new { @class = "form-control input-sm", @placeholder = "区县街道", @datatype = "*1-100", @errormsg = "详细地址不能超过100个字符！", @nullmsg = "请输入详细地址！" })
                </div>
            </div>
        </div>
    </div>
    <div class="row">
        <div class="col-md-10">
            <div class="form-group">
                <label class="col-sm-2 control-label">备注信息</label>
                <div class="col-sm-8">
                    @Html.TextAreaFor(c => c.Memo, new { @class = "form-control ", @placeholder = "", @datatype = "*1-200", @errormsg = "备注不能超过200个字符！", @ignore = "ignore" })
                </div>
            </div>
        </div>
    </div>
    <div class="modal-footer" style="margin: 1% 20% 1% 1%;">
        <input type="submit" class="btn btn-primary" value="保存" />
        <button type="button" class="btn btn-default" data-dismiss="modal" onclick="javascript:history.back(-1);">取消</button>
    </div>
    @{Html.EndForm();}
</div>
<script src="~/Content/admin/js/bootstrap.min.js"></script>
<script src="/Content/Validform_v5.3.2/Validform_v5.3.2_min.js"></script>
<script src="~/Content/layer/layer.js"></script>
<script type="text/javascript">
    function ShowValidformMsg(msg, id) {

        layer.tips(msg, '#' + id, { tipsMore: true });
    }
    $(function () {
        $("#add").Validform({
            // tiptype: 1
            showAllError: true,
            ajaxPost: true,
            beforeSubmit: function (curform) {
                layer.msg('正在执行操作...', { icon: 16 });

                return true;
            },
            callback: function (data) {
                if (data.succ) {
                    window.open('/business/business/list', "mainFrame")
                }
            },
            tiptype: function (msg, o) {
                if (o.type == 3)
                { ShowValidformMsg(msg, $(o.obj).attr("id")); }
            }
        }
        );
    });
</script>
